package com.link.base.base.trackhead.service;
/**
 * @author: 秦学刚
 * @date: 2018-11-21
 * @comments:
 */

import javax.annotation.Resource;

import com.link.base.base.trackchild.dao.mybatis.mapper.TrackchildMapper;
import com.link.base.base.trackchild.model.Trackchild;
import com.link.base.base.trackhead.dao.mybatis.mapper.TrackheadMapper;
import com.link.base.base.trackhead.model.Trackhead;
import org.springframework.stereotype.Service;

import com.link.core.basic.dao.mapper.BasicMapper;
import com.link.core.basic.service.BasicServiceImpl;

@Service
public class TrackheadServiceImpl extends BasicServiceImpl<Trackhead> implements TrackheadService {

    @Resource
    private TrackheadMapper trackheadMapper;
    @Resource
    private TrackchildMapper trackchildMapper;
    
    @Override
    public BasicMapper<Trackhead> getBasicMapper() {
        return trackheadMapper;
    }

    @Override
    public void beforDelete(Trackhead entity) throws Exception {
        //删除子表内容
        Trackchild trackchild = new Trackchild();
        trackchild.setHeadId(entity.getId());
        trackchildMapper.deleteByHeadId(trackchild);
    }
}

